package cn.mymall.entity.mall;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.sql.Timestamp;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("mall_cart_item")
public class CartItem extends Model {
	private static final long serialVersionUID = -3302808518025252990L;

	/**
	 * 购物车详细项
	 */
	@TableId(value = "id",type = IdType.AUTO)
	private Integer id;
	private Integer memberId;					//会员id
	private Integer productId;					//商品id
	private Integer skuId;						//skuid
	private Integer qty;						//购买数量
	private BigDecimal sellPrice;				//商品价格
	private Timestamp addTime;
	public CartItem() {
	}

	public CartItem(Integer memberId, Sku sku, Integer qty){
		this.memberId = memberId;
		this.productId = sku.getProductId();
		this.skuId = sku.getId();
		this.qty = qty;
		this.sellPrice = sku.getSellPrice();
	}
}
